Optimal. Leaf size=87 \[ -((a B-b C) x)+\frac {(b B+a C) \log (\cos (c+d x))}{d}+\frac {(a B-b C) \tan (c+d x)}{d}+\frac {(b B+a C) \tan ^2(c+d x)}{2 d}+\frac {b C \tan ^3(c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.139, Rules used = {3713, 3673,
3609, 3606, 3556} \begin {gather*} \frac {(a C+b B) \tan ^2(c+d x)}{2 d}+\frac {(a B-b C) \tan (c+d x)}{d}+\frac {(a C+b B) \log (\cos (c+d x))}{d}-x (a B-b C)+\frac {b C \tan ^3(c+d x)}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3673
Rule 3713
Rubi steps
\begin {align*} \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx &=\int \tan ^2(c+d x) (a+b \tan (c+d x)) (B+C \tan (c+d x)) \, dx\\ &=\frac {b C \tan ^3(c+d x)}{3 d}+\int \tan ^2(c+d x) (a B-b C+(b B+a C) \tan (c+d x)) \, dx\\ &=\frac {(b B+a C) \tan ^2(c+d x)}{2 d}+\frac {b C \tan ^3(c+d x)}{3 d}+\int \tan (c+d x) (-b B-a C+(a B-b C) \tan (c+d x)) \, dx\\ &=-(a B-b C) x+\frac {(a B-b C) \tan (c+d x)}{d}+\frac {(b B+a C) \tan ^2(c+d x)}{2 d}+\frac {b C \tan ^3(c+d x)}{3 d}+(-b B-a C) \int \tan (c+d x) \, dx\\ &=-(a B-b C) x+\frac {(b B+a C) \log (\cos (c+d x))}{d}+\frac {(a B-b C) \tan (c+d x)}{d}+\frac {(b B+a C) \tan ^2(c+d x)}{2 d}+\frac {b C \tan ^3(c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.41, size = 86, normalized size = 0.99 \begin {gather*} \frac {(-6 a B+6 b C) \text {ArcTan}(\tan (c+d x))+6 (b B+a C) \log (\cos (c+d x))+6 (a B-b C) \tan (c+d x)+3 (b B+a C) \tan ^2(c+d x)+2 b C \tan ^3(c+d x)}{6 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.08, size = 99, normalized size = 1.14
method | result | size |
norman | \(\left (-a B +C b \right ) x +\frac {\left (a B -C b \right ) \tan \left (d x +c \right )}{d}+\frac {\left (B b +C a \right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {b C \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}-\frac {\left (B b +C a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(88\) |
derivativedivides | \(\frac {\frac {b C \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {b B \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {C a \left (\tan ^{2}\left (d x +c \right )\right )}{2}+B \tan \left (d x +c \right ) a -C b \tan \left (d x +c \right )+\frac {\left (-B b -C a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-a B +C b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(99\) |
default | \(\frac {\frac {b C \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {b B \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {C a \left (\tan ^{2}\left (d x +c \right )\right )}{2}+B \tan \left (d x +c \right ) a -C b \tan \left (d x +c \right )+\frac {\left (-B b -C a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-a B +C b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(99\) |
risch | \(-i B b x -i C a x -B a x +C b x -\frac {2 i B b c}{d}-\frac {2 i C a c}{d}+\frac {2 i \left (-3 i B b \,{\mathrm e}^{4 i \left (d x +c \right )}-3 i C a \,{\mathrm e}^{4 i \left (d x +c \right )}+3 a B \,{\mathrm e}^{4 i \left (d x +c \right )}-6 C b \,{\mathrm e}^{4 i \left (d x +c \right )}-3 i B b \,{\mathrm e}^{2 i \left (d x +c \right )}-3 i C a \,{\mathrm e}^{2 i \left (d x +c \right )}+6 a B \,{\mathrm e}^{2 i \left (d x +c \right )}-6 C b \,{\mathrm e}^{2 i \left (d x +c \right )}+3 a B -4 C b \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B b}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C a}{d}\) | \(213\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 86, normalized size = 0.99 \begin {gather*} \frac {2 \, C b \tan \left (d x + c\right )^{3} + 3 \, {\left (C a + B b\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (B a - C b\right )} {\left (d x + c\right )} - 3 \, {\left (C a + B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (B a - C b\right )} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.63, size = 85, normalized size = 0.98 \begin {gather*} \frac {2 \, C b \tan \left (d x + c\right )^{3} - 6 \, {\left (B a - C b\right )} d x + 3 \, {\left (C a + B b\right )} \tan \left (d x + c\right )^{2} + 3 \, {\left (C a + B b\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (B a - C b\right )} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.12, size = 139, normalized size = 1.60 \begin {gather*} \begin {cases} - B a x + \frac {B a \tan {\left (c + d x \right )}}{d} - \frac {B b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b \tan ^{2}{\left (c + d x \right )}}{2 d} - \frac {C a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {C a \tan ^{2}{\left (c + d x \right )}}{2 d} + C b x + \frac {C b \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {C b \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right ) \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \tan {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 1017 vs.
\(2 (83) = 166\).
time = 1.05, size = 1017, normalized size = 11.69 \begin {gather*} -\frac {6 \, B a d x \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 6 \, C b d x \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, C a \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, B b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 18 \, B a d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 18 \, C b d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 3 \, C a \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, B b \tan \left (d x\right )^{3} \tan \left (c\right )^{3} + 9 \, C a \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 9 \, B b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 6 \, B a \tan \left (d x\right )^{3} \tan \left (c\right )^{2} - 6 \, C b \tan \left (d x\right )^{3} \tan \left (c\right )^{2} + 6 \, B a \tan \left (d x\right )^{2} \tan \left (c\right )^{3} - 6 \, C b \tan \left (d x\right )^{2} \tan \left (c\right )^{3} + 18 \, B a d x \tan \left (d x\right ) \tan \left (c\right ) - 18 \, C b d x \tan \left (d x\right ) \tan \left (c\right ) - 3 \, C a \tan \left (d x\right )^{3} \tan \left (c\right ) - 3 \, B b \tan \left (d x\right )^{3} \tan \left (c\right ) + 3 \, C a \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 3 \, B b \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 3 \, C a \tan \left (d x\right ) \tan \left (c\right )^{3} - 3 \, B b \tan \left (d x\right ) \tan \left (c\right )^{3} + 2 \, C b \tan \left (d x\right )^{3} - 9 \, C a \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 9 \, B b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 12 \, B a \tan \left (d x\right )^{2} \tan \left (c\right ) + 18 \, C b \tan \left (d x\right )^{2} \tan \left (c\right ) - 12 \, B a \tan \left (d x\right ) \tan \left (c\right )^{2} + 18 \, C b \tan \left (d x\right ) \tan \left (c\right )^{2} + 2 \, C b \tan \left (c\right )^{3} - 6 \, B a d x + 6 \, C b d x + 3 \, C a \tan \left (d x\right )^{2} + 3 \, B b \tan \left (d x\right )^{2} - 3 \, C a \tan \left (d x\right ) \tan \left (c\right ) - 3 \, B b \tan \left (d x\right ) \tan \left (c\right ) + 3 \, C a \tan \left (c\right )^{2} + 3 \, B b \tan \left (c\right )^{2} + 3 \, C a \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + 3 \, B b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + 6 \, B a \tan \left (d x\right ) - 6 \, C b \tan \left (d x\right ) + 6 \, B a \tan \left (c\right ) - 6 \, C b \tan \left (c\right ) + 3 \, C a + 3 \, B b}{6 \, {\left (d \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 3 \, d \tan \left (d x\right ) \tan \left (c\right ) - d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.83, size = 84, normalized size = 0.97 \begin {gather*} \frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,a-C\,b\right )-\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {B\,b}{2}+\frac {C\,a}{2}\right )+{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,b}{2}+\frac {C\,a}{2}\right )-d\,x\,\left (B\,a-C\,b\right )+\frac {C\,b\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________